package com.example.mvc;

import com.alibaba.nacos.spring.context.annotation.config.NacosPropertySource;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

import java.io.IOException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@SpringBootApplication
@EnableAspectJAutoProxy
@NacosPropertySource(dataId = "example", autoRefreshed = true)
public class MvcApplication {


	public static void main(String[] args) throws IOException {
		System.out.println("777");
		System.out.println("888");
		SpringApplication.run(MvcApplication.class, args);

//		ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(3, 3, 0L, TimeUnit.SECONDS, new ArrayBlockingQueue<>(1), new ThreadPoolExecutor.CallerRunsPolicy());
//
//		ThreadLocal<LocalDateTime> threadLocal = ThreadLocal.withInitial(() -> {return null;});
//		for (int i = 0; i < 10; i++) {
//			threadPoolExecutor.execute(() -> {
//				LocalDateTime time = threadLocal.get();
//				if (time == null) {
//					threadLocal.set(LocalDateTime.now());
//					System.out.println("first " + Thread.currentThread().getId() + "   " + threadLocal.get());
//				} else {
//					threadLocal.set(LocalDateTime.now());
//					System.out.println(Thread.currentThread().getId() + "   " + threadLocal.get());
//				}
//				try {
//					Thread.sleep(1000L);
//				} catch (InterruptedException e) {
//					e.printStackTrace();
//				}
//			});
//		}
//		System.in.read();

	}

//	@Deprecated
	public static void a(List<String> list) {
		System.out.println("测试回滚666");
		System.out.println("online");
		System.out.println("test1");
		System.out.println("test1222");
		for (String s : list) {
			System.out.println(s);
		}

	}

	/*submitCheck(末级部门，L5人数){
		if(人数>=10){
			if(四舍五入（人数/10）<=L5人数){
				pass
			}else{
				error
			}
		}else{
			if(平级M1里最后提交){
				if(M2下已提交>=应提交){
					pass
				}else{
					if(是否是M3下所有M2下的最后M1提交){
						if(M3下已提交>=应提交){
			    ...最多追溯到一级部门
						}
					}else{
						pass
					}
				}
			}else{
				pass
			}
		}
	}*/



	//	@Deprecated
	public static void b(List<String> list) {
		System.out.println("online111");
		System.out.println("online");
		for (String s : list) {
			System.out.println(s);
		}

	}

}
